import json
import argparse
import os

# paser = argparse.ArgumentParser("merge json file!!!")
# paser.add_argument("--filepath", default="./json", type=str)
# paser.add_argument("--filepath", default="./json", type=str)
# opts = paser.parse_args()

a = {}
save_json_path = 'merge.json'
# for _, _, files in os.walk(opts.filepath):
files = [os.sys.argv[1], os.sys.argv[2]]
for f in files:
    print("file {}".format(f))
    if 'json' in f:
        with open(f,'r') as fp:
            data = json.load(fp)
            for k in data.keys():
                if k=='type':
                    continue
                print("{} {}".format(k, type(data[k])))
                if k not in a.keys():
                    a[k] = data[k]
                else:
                    a[k].extend(data[k])
                print(a[k])

#json.dump(a, open(save_json_path, 'w'), indent=4)  # indent=4 更加美观显示


